|
|
|
|
|
|
|
One way to create a resource file is by using the Application Wizard. Of course, this works only when you're creating a new application. When you use the Application Wizard to create a new application, you're asked whether you want to create a resource file for the application (see Figure 19.6). Then, if you choose to use the resource file, you can edit it later to include more resources as the application grows. |
|
|
|
|
|
|
|
|
Figure 19.6.
Defining a new Resource file with the Application Wizard. |
|
|
|
|
|
|
|
|
Because a resource file is nothing more than a simple text file, you can use NotePad or Wordpad to create it. Before you start the text editor, however, you should do some design work to decide what you want to include in the file. The resources that you can include in a resource file are divided into two types: simple resources are strings and message tables, whereas complex resources are binary resources such as bitmaps, sounds, and videos. |
|
|
|
|
|
|
|
|
To understand how to use a resource file, you must first understand its building blocks. A resource file is created by using one or more of the following commands or statements. |
|
|
|
|
|
|
|
|
Preprocessing directives are used to control what the resource compiler will do with the statements included in the definition file. The first directive listed allows you to define variable names and their values to be used later in the file. The remaining directives control which sections of the file will be compiled: |
|
|
|
|
|
|
|
|
#define defines a specified name by assigning it a given value. |
|
|
|
|
|
|
|
|
#elif marks an optional clause of a conditional-compilation block. |
|
|
|
|
|
|
|
|
#else marks the last optional clause of a conditional-compilation block. |
|
|
|
|
|